package com.wqh.config;

import com.netflix.loadbalancer.IPing;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.PingUrl;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wanqh
 * @date 2018/01/11 14:51
 * @description:
 */
@Configuration
public class UserServiceConfig {
    /**
     *将服务检查策略改为PingUrl
     * @return
     */
    @Bean
    public IPing ribbonPing(){
        return new PingUrl();
    }
    /**
     * 将负载均衡的策略改为随机选取服务实例
     * @return
     */
    @Bean
    public IRule ribbonRule(){
        return new RandomRule();
    }
}
